import request from '@/config/axios'

export interface Model {
  id: string
  merchantId: string
  appId: string
  channelId: string
  channelCode: string
  orderId: string
  tradeNo: string
  merchantOrderId: string
  merchantRefundNo: string
  notifyUrl: string
  notifyStatus: number
  type: number
  payAmount: number
  refundAmount: number
  reason: string
  userIp: string
  channelOrderNo: string
  channelRefundNo: string
  channelErrorCode: string
  channelErrorMsg: string
  channelExtras: string
  expireTime: Date
  successTime: Date
  notifyTime: Date
  createTime: Date
}

export interface RefundPageReqVO extends PageParam {
  merchantId?: number
  appId?: number
  channelId?: number
  channelCode?: string
  orderId?: string
  tradeNo?: string
  merchantOrderId?: string
  merchantRefundNo?: string
  notifyUrl?: string
  notifyStatus?: number
  status?: number
  type?: number
  payAmount?: number
  refundAmount?: number
  reason?: string
  userIp?: string
  channelOrderNo?: string
  channelRefundNo?: string
  channelErrorCode?: string
  channelErrorMsg?: string
  channelExtras?: string
  expireTime?: Date[]
  successTime?: Date[]
  notifyTime?: Date[]
  createTime?: Date[]
}

export interface PayRefundExportReqVO {
  merchantId?: number
  appId?: number
  channelId?: number
  channelCode?: string
  orderId?: string
  tradeNo?: string
  merchantOrderId?: string
  merchantRefundNo?: string
  notifyUrl?: string
  notifyStatus?: number
  status?: number
  type?: number
  payAmount?: number
  refundAmount?: number
  reason?: string
  userIp?: string
  channelOrderNo?: string
  channelRefundNo?: string
  channelErrorCode?: string
  channelErrorMsg?: string
  channelExtras?: string
  expireTime?: Date[]
  successTime?: Date[]
  notifyTime?: Date[]
  createTime?: Date[]
}

// 查询列表退款订单
export const getRefundPage = (params: RefundPageReqVO) => {
  return request.get({ url: import.meta.env.VITE_BASE_ROLE + '/pay/refund/page.json', params })
}

// 查询详情退款订单
export const getRefund = (id: string) => {
  return request.get({ url: import.meta.env.VITE_BASE_ROLE + '/pay/refund/getById.json?id=' + id })
}

// 修改退款订单
export const update = (data: Model) => {
  return request.put({ url: import.meta.env.VITE_BASE_ROLE + '/pay/refund/update.json', data })
}

// 删除退款订单
export const del = (id: string) => {
  return request.delete({ url: import.meta.env.VITE_BASE_ROLE + '/pay/refund/del.json?id=' + id })
}
